Remove system-defined taxonomies, CONTENT_TAGGING_AUTO - #38895
Remove system-defined taxonomies, CONTENT_TAGGING_AUTO#38895bradenmacdonald wants to merge 4 commits into
Conversation
|
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
Thanks for the pull request, @bradenmacdonald! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
dd9ff31 to
7b4c37c
Compare
| @@ -0,0 +1,122 @@ | |||
| """ | |||
There was a problem hiding this comment.
This was renamed from test_tasks.py. Most of the code was existing code, but I removed all the tests related to auto-tagging and only left in the tests related to auto-deleting tags when the content gets deleted.
7b4c37c to
d998f80
Compare
|
I'll start by sharing Claude Code review:
|
Ah, there were indeed a few issues there. That one API was actually calling the upstream API instead of the platform's override version, bypassing org checks for superusers. Fixed in 6891b46
It was intentional. A recent unrelated refactor on
I missed that with my own find-and-replace, because of the typo. Fixed.
Good point. It's a completely unused feature and I've now removed it from the openedx-core PR as well. Thanks @jesperhodge (and Claude :P)! |
| @@ -1,2 +1,2 @@ | |||
| """ | |||
| Automatic tagging of content | |||
There was a problem hiding this comment.
| Handlers for Content Tagging |
| @@ -0,0 +1,122 @@ | |||
| """ | |||
| Test for auto-tagging content | |||
There was a problem hiding this comment.
| Test for auto-tagging content | |
| Test for content tagging handlers |
|
|
||
|
|
||
| @skip_unless_cms # Automatically deleting tags when an object is deleted only applies to the CMS | ||
| class TestAutoTagHandlers( # type: ignore[misc] |
There was a problem hiding this comment.
| class TestAutoTagHandlers( # type: ignore[misc] | |
| class TestContentTaggingHandlers( # type: ignore[misc] |
| LiveServerTestCase | ||
| ): | ||
| """ | ||
| Test if the Course and XBlock tags are automatically created |
There was a problem hiding this comment.
| Test if the Course and XBlock tags are automatically created | |
| Test Content Tag handling when tagged courses or libraries are deleted or restored |
| If any of the taxonomies are not configured for use by the org that owns | ||
| the content, this will raise ``InvalidOrgException``, unless you also pass | ||
| ``ignore_invalid_orgs=True``. |
There was a problem hiding this comment.
Question, nit (non-blocking):
Just for curiosity, why support an ignore_invalid_orgs flag? The purpose is just to silence the error, or am I misunderstanding that?
| # -r requirements/edx/doc.txt | ||
| # -r requirements/edx/testing.txt | ||
| # xblocks-contrib | ||
| openedx-core==1.1.0 |
There was a problem hiding this comment.
Reminder: revert before merge
| # via | ||
| # -r requirements/edx/base.txt | ||
| # xblocks-contrib | ||
| openedx-core==1.1.0 |
There was a problem hiding this comment.
Reminder: revert before merge
| # via | ||
| # -r requirements/edx/base.txt | ||
| # xblocks-contrib | ||
| openedx-core==1.1.0 |
There was a problem hiding this comment.
Reminder: revert before merge
| @@ -227,29 +229,40 @@ def ensure_user_has_can_tag_object_permissions(self, user, tags_data, object_id) | |||
|
|
|||
| def update(self, request, *args, **kwargs) -> Response: | |||
There was a problem hiding this comment.
Can we specify args / kwargs? I think also maybe relevant for OpenAPI spec. (If this is already done somewhere in the serializer, ignore this.)
|
|
||
| def update(self, request, *args, **kwargs) -> Response: | ||
| """ | ||
| Extend the update method to fire CONTENT_OBJECT_ASSOCIATIONS_CHANGED event |
There was a problem hiding this comment.
Would it make sense to refactor this so the override only contains what's actually different from the parent? Right now update() duplicates the parent's entire body (PATCH rejection, validation, permission check, the final retrieve()) even though the only real difference is how each taxonomy's tags get applied.
Concretely: could we extract the per-taxonomy tagging step — the tag_object() call plus its exception-to-ValidationError translation — into its own small method on the parent (something like _apply_taxonomy_tags), and have the parent's update() call it inside the loop? Then this subclass would only need to override that one method (to call the platform's org-scoped tag_object wrapper and add the extra InvalidOrgException handling), and could drop its update() override entirely, inheriting the parent's version as-is.
That would mean this class stays in sync automatically if the parent's update() changes later, and a reader only has to look at the one method that's genuinely platform-specific rather than diffing two near-identical copies.
Description
This PR, along with openedx/openedx-core#654 (which must merge first), will:
tag_objectAPI would silently fail if the taxonomy was not enabled for the org that owns the content you are trying to tag. As a result, a couple of test cases were not even testing what they thought, because the tags never got created in the first place.Supporting information
Implements openedx/openedx-core#634
Testing instructions
Verify that the taxonomy editor and content tagging features are working as normal.
Sandbox: https://studio.pr-38895-885846.axim-sandboxes.opencraft.hosting/
Deadline
None